using Microsoft.EntityFrameworkCore;
using FirstTea.Domain.Entities;

namespace FirstTea.Infrastructure
{
    public class FirstTeaDbContext : DbContext
    {
        public FirstTeaDbContext(DbContextOptions<FirstTeaDbContext> options) : base(options) { }

        public DbSet<User> Users { get; set; }
        public DbSet<Tea> Teas { get; set; }
        public DbSet<TeaType> TeaTypes { get; set; }
        public DbSet<Order> Orders { get; set; }
        public DbSet<OrderItem> OrderItems { get; set; }
        public DbSet<Cart> Carts { get; set; }
        public DbSet<CartItem> CartItems { get; set; }
        public DbSet<Address> Addresses { get; set; }
        public DbSet<Review> Reviews { get; set; }
        public DbSet<Payment> Payments { get; set; }
        public DbSet<Conversation> Conversations { get; set; }

        protected override void OnConfiguring(DbContextOptionsBuilder optionsBuilder)
        {
            if (!optionsBuilder.IsConfigured)
            {
                optionsBuilder.UseMySql(
                    "server=localhost;database=firsttea;user=root;password=123456",
                    new MySqlServerVersion(new Version(8, 0, 36))
                );
            }
        }
    }
}
